#pragma once

#include "SynTableEntry.h"
#include "Synonym.h"

#include <set>
#include <vector>
#include <map>
using namespace std;

/* ------------------------------------------------------------------------------------------
* A class that contains all synonyms affecting the result and their respective indexes.
* ------------------------------------------------------------------------------------------- */

class SynTable
{
private:
	int indexCount;
	map<string, SynTableEntry> synIndex;
	map<int, SynTableEntry> revIndex;

public:
	/** Constructor
	 * Initialise all SynTable data structures etc.
	 */
	SynTable::SynTable();

	/** 
	 * Get the no. of SynTableEntry
	 * @return a int of the no. of SynTableEntry
	 */
	int getNoOfEntries();

	/** 
	 * Get the SynTableEntry with entryNo == to index
	 * @param index index of SynTableEntry to be retrieved
	 * @return the SynTableEntry with entryNo == to index
	 */
	SynTableEntry getAt(int index);

	/** 
	 * Get the SynTableEntry with synonym name matching synName
	 * @param synName name of SynTableEntry to be retrieved
	 * @return the SynTableEntry with synonym name matching synName
	 */
	SynTableEntry getByName(string synName);

	/**
	 * Adds a SynTableEntry to the SynTable
	 * @param syn synonym that contains the VAR_TYPE and name of the synonym
	 * @param values vector of valid indexes
	 * @return true if entry is added and it has valid indexes, false if entry has no valid indexes
	 */
	bool addSyn(Synonym* syn, vector<int> values);
	
	/**
	 * Get the vector of valid indexes of the synonym specified in toSearch
	 * @param toSearch synonym to return indexes of
	 * @return vector of int of the indexes
	 */
	vector<int> getResults(Synonym toSearch);
};